package main

import "fmt"

func main() {
	//定义局部变量
	var a, b int = 100, 200

	var result int

	//调用函数并返回最大值
	result = max1(a, b)

	fmt.Println("最大值是：", result)

	c1, c2 := swap1(a, b)
	fmt.Printf("c1的值为：%d\n", c1)
	fmt.Printf("c2的值为：%d\n", c2)
}

/**
只有一个返回值的函数
 */
func max1(number1, number2 int) int {
	var result int

	if number1 > number2 {
		result = number1
	} else if number1 == number2 {
		result = number1
	} else {
		result = number2
	}
	return result
}

/**
拥有多个返回值的函数
 */
func swap1(num1, num2 int) (int, int) {
	return num2, num1
}
